package Person.ith_08;

 class Animal {
    private String name;
    private int age;
    public final String COLOR = "黑色";

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
//定义DOG类继承Animal
class Dog extends Animal{
    //Dog作为Animal的子类，在Main方法中调用的是Animal中的set/get方法，说明子类可以继承父类中的内容；

}
 class Main{
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.setName("牧羊犬");
        dog.setAge(3);
        System.out.println("名称："+dog.getName()+",年龄："+dog.getAge()+",颜色："+dog.COLOR);
    }
}
